package timingwheel

import (
	"context"
	"time"
)

type ScheduleBuilder struct {
	TickerDuration int
	TickerUnit     time.Duration
	WheelCount     int
	Ctx            context.Context
	jobBuffer      int
}

func (b *ScheduleBuilder) Build() *Schedule {
	schedule := &Schedule{
		wheelCount: createWheel(b.WheelCount),
		cxt:        b.Ctx,
		tickerMs:   b.TickerDuration,
		isRunning:  false,
	}
	schedule.tickerTimer = b.TickerUnit
	schedule.jobBuffer = b.jobBuffer
	schedule.init()
	return schedule
}

func NewScheduleBuilder() *ScheduleBuilder {
	return &ScheduleBuilder{}
}
